package com.friehome.app;

import java.util.ArrayList;
import java.util.List;

import model.LTServiceModel;
import model.PeopleModel;

import org.xutils.x;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

import adapter.MainAdapter;
import android.app.Activity;
import android.content.Intent;
import android.database.DataSetObserver;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity extends Activity {

	@ViewInject(R.id.text1)
	TextView text1;
	@ViewInject(R.id.text2)
	TextView text2;
	@ViewInject(R.id.text3)
	TextView text3;
	@ViewInject(R.id.text4)
	TextView text4;
	@ViewInject(R.id.text5)
	TextView text5;
	@ViewInject(R.id.text6)
	TextView text6;
	@ViewInject(R.id.text7)
	TextView text7;
	@ViewInject(R.id.text8)
	TextView text8;
	@ViewInject(R.id.text9)
	TextView text9;
	
	@ViewInject(R.id.listView)
	ListView listView;
	
	@ViewInject(R.id.listView2)
	ListView listView2;
	
	List<LTServiceModel> data1 = new ArrayList<LTServiceModel>();
	List<LTServiceModel> data2 = new ArrayList<LTServiceModel>();
	
	PeopleModel peopleModel;
	String id;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		x.view().inject(this);
		
		
		id = getIntent().getExtras().getString("id");
				
		peopleModel = new PeopleModel();
		
		
		
		for (int i = 0; i < 10; i++) {
			LTServiceModel l = new LTServiceModel();
			l.name = "鲜花";
			l.count = "" + i;
			data1.add(l);
		}
		for (int i = 0; i < 10; i++) {
			LTServiceModel l = new LTServiceModel();
			l.name = "鲜花";
			l.count = "" + i;
			data2.add(l);
		}
		
		listView.setAdapter(new MainAdapter(getApplicationContext(), data1));
		listView2.setAdapter(new MainAdapter(getApplicationContext(), data2));
		
		setView();
		
	}

	public void setView(){
		text1.setText(peopleModel.name);
		text2.setText(peopleModel.sex);
		text3.setText(peopleModel.address);
		text4.setText(peopleModel.lianxiren);
		text5.setText(peopleModel.lianxiren);
		text6.setText(peopleModel.timeBegin);
		text7.setText(peopleModel.timeEnd);
		text8.setText(peopleModel.remark);
		text9.setText(peopleModel.task);
		
	}
	@Event(value={R.id.content_btn1,R.id.content_btn2,R.id.content_btn3,R.id.content_btn4,R.id.content_btn5})
	private void onClick(View v){
		
		Intent intent = new Intent();
		switch (v.getId()) {
		case R.id.content_btn1:
			intent.setClass(this, DCActivity.class);
			startActivity(intent);
			break;
		case R.id.content_btn2:
			intent.setClass(this, PJActivity.class);
			startActivity(intent);
			break;
		case R.id.content_btn3:
			intent.setClass(this, SearchActivity.class);
			startActivity(intent);
			break;
		case R.id.content_btn4:
			intent.setClass(this, JDActivity.class);
			startActivity(intent);
			break;
		case R.id.content_btn5:
			finish();
			break;

		default:
			break;
		}
	}
	
	@Event(value={R.id.content_btn11,R.id.content_btn22,R.id.content_btn33})
	private void onClick2(View v){
		
		switch (v.getId()) {
		case R.id.content_btn11:
			
			break;
		case R.id.content_btn22:
			
			break;
		case R.id.content_btn33:
			
			break;

		default:
			break;
		}
	}
	
}
